package Data;

import java.io.IOException;
import java.util.ArrayList;
import Data.Operation.FileOperation;
import Data.Shopuser.User;

public class UserList {
	private ArrayList<User> users;
	private String filename;
	private FileOperation one;
	
	public UserList(){
		one=new FileOperation(filename);
		users=one.readFile();
	}
	
	public String toStirng(){
		String s = null;
		for(int i=0;i<users.size();i++){
			s=s+users.get(i).toString();
		}
		return s;
	}
	public UserList(String filename){
		this.filename=filename;
		one=new FileOperation(filename);
		users=one.readFile();
	}
	
   public ArrayList<User> get(){
	    return users;
   }
   
   public void update() throws IOException{
	   one.newwritefile(users);
   }
}
